#pragma once

struct deserialized_element {
	char type;
	union {
		unsigned int int_val; // also boolean, no float support yet
		std::string *string;
		std::map<std::string, deserialized_element> *array; // pointer in der map entfernen
	};
	/*~deserialized_element()
	{
		if (type == 's')
			delete string;
		else
			delete array;
	}*/
};

class PHPUnserializer
{
public:
	PHPUnserializer(void);
	~PHPUnserializer(void);

	deserialized_element* deserialize(std::string str);
	void destroyElement(deserialized_element* element);
private:
	deserialized_element* _deserialize(std::string str);
	void _destroyElement(deserialized_element* element);
};
